package com.springboot.system.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.springboot.system.domain.log.SysLogVO;
import com.springboot.system.domain.online.OnlineUserFilter;
import com.springboot.system.service.LogService;
import com.springboot.system.service.OnlineUserService;
import com.springboot.core.security.permission.CheckPermission;
import com.springboot.core.web.mvc.BaseRest;
import com.springboot.core.web.mvc.R;

/**
 * 日志接口
 * 
 * @ClassName: LogRest
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @author 252956
 * @date 2019年10月21日 下午4:56:10
 *
 */
@RestController
@RequestMapping(value = "/rest/monitor")
public class MonitorRest extends BaseRest {
	@Autowired
	private LogService logService;
	@Autowired
	private OnlineUserService onlineUserService;

	@RequestMapping(value = "/blog/page", method = RequestMethod.POST)
	public R page(@RequestBody SysLogVO vo) {
		return R.ok(logService.page(vo));
	}

	@RequestMapping(value = "/online/user", method = RequestMethod.POST)
	public R onlineUser(@RequestBody OnlineUserFilter filter) {
		return R.ok(onlineUserService.onlineUser(filter));
	}

	@RequestMapping(value = "/online/kickout", method = RequestMethod.GET)
	public R onlineUser(String token) {
		onlineUserService.kickoutByToken(token);
		return R.ok();
	}

}
